Fix Dashboards/Metrics in Main View and Reports#29
Merged
Conversation
- Fix Weekly Activity Trend using Math.random() instead of actual data - Remove local formatDuration that shadowed the correct imported version (was treating ms values as seconds, showing wrong durations) - Add avgDuration to backend repo stats aggregation pipeline - Fix division-by-zero crashes when totalRuns is 0 - Render the Weekly Activity Trend chart (was computed but never shown) - Expand recentRuns query to 7 days for meaningful trend data - Layout success rates + trend side-by-side for better use of space Fixes #21
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
homeles
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes multiple bugs in the Stats/Reports view and backend metrics pipeline.
Bugs Fixed
1. Weekly Activity Trend was using Math.random()
The trend chart was generating random data on every render instead of using actual workflow run dates. Now queries the last 7 days of runs and counts per day.
2. Duration formatting was wrong (seconds vs milliseconds)
A local
formatDurationfunction at the bottom ofRepositoryStats.jsxshadowed the correctly-imported one fromstatusHelpers.js. The local version treated millisecond values as seconds, showing wildly incorrect durations. Removed the local version and now uses the shared utility.3. Missing avgDuration in repo stats
The backend MongoDB aggregation pipeline in
calculateWorkflowStatsdidn't computeavgDurationper repository, so the Stats view always showed "N/A" for repository durations. Added$subtract+$avgto the pipeline.4. Division by zero crashes
When
totalRunsis 0 for an org or repo, calculating success rate would produce NaN or crash. Added guards in 3 places.5. Weekly Activity Trend chart was never rendered
trendDatawas computed but the Line chart was never included in the JSX. Now rendered side-by-side with the Success Rates chart.6. recentRuns query was limited to 5
The backend only returned 5 recent runs, not enough for a 7-day trend. Now queries all runs from the last 7 days.
Files Changed
client/src/features/stats/RepositoryStats.jsx— all frontend fixesserver/src/services/workflowService.js— backend aggregation + query fixFixes #21